<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/jsp/inc/header.jsp" %>
<c:set var="title" value="栏目"/>
<c:set var="rootpath" value="${CONTEXT_PATH}/admin/site/column"/>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="${STATIC_HOST}/css/ligerui.css" rel="stylesheet" type="text/css"/>
    <link href="${STATIC_HOST}/css/common.css" rel="stylesheet" type="text/css" />
    <script src="${STATIC_HOST}/js/common.js" type="text/javascript"></script>
    <script src="${STATIC_HOST}/js/LG.js" type="text/javascript"></script>
    <title>${title}管理</title>
</head>
<body class="listbody">

<!-- 搜索开始 -->
<div id="mainsearch">
  <div class="searchbox">
  <form action="${rootpath}/list.do" method="post" name="searchForm" id="searchForm">
    <input name="tree" id="listTree" type="hidden" value="${tree}"/>
    <ul>
       <li style="float:left;"><label for="eqId">栏目ID</label>:</li>
           <li class="li_search_right" style="padding-right:10px;">
        <input type="text" name="eqId" id="eqId" size="10" ltype='text' ligerui='{"width":70}'  value="${eqId}" r/>
      </li> 
       <li style="float:left;"><label for="likeName">栏目名称</label>:</li>
           <li class="li_search_right" style="padding-right:10px;">
        <input type="text" name="likeName" id="likeName" size="14" ltype='text'  ligerui='{"width":70}'  value="${likeName}"/>
      </li> 
       <li style="float:left;"><label for="eqCode">栏目代号</label>:</li>
           <li class="li_search_right" style="padding-right:10px;">
        <input type="text" name="eqCode" id="eqCode" size="14" ltype='text'  ligerui='{"width":70}'  value="${eqCode}"/>
      </li>
      <input type="hidden" name="eqStatus" id="eqStatus" value="${empty(eqStatus)?1:eqStatus}"/>
      <div id="searchbutton" class="button button2 buttonnoicon">
        <div class="button-l"></div>
        <div class="button-r"></div>
        <span>搜索</span>
	  </div>
	</ul>
  </form>
  </div>
</div>
<!-- 搜索结束 -->    

<div class="div_newline"></div>

<!-- 列表开始 -->
<div id="maingrid"></div> 
<!-- 列表结束 -->

<div class="blank10"></div>
<p class="tc">
<input type="button" value="确认" class="l-button" onclick="parent.window.f_selectDO(f_selected())"> 
<input type="button" value="取消" class="l-button" onclick="parent.window.f_selectCancel()">
</p>

<script type="text/javascript">
	var statusmap=${jsonali:toJSONString(statusMap)};
	var grid = $("#maingrid").ligerGrid({
      columns: [
        { display:"栏目ID", name:"id", align: 'left', width: 80, type: 'int', frozen: false, render: function(row){
              return ""+row.id+"";
            }
         },
        { display:"栏目名称", name:"name", align: 'left', width: 100 },
        { display:"栏目代号", name:"code", align: 'left', width: 100 },
        { display:"栏目URL", name:"url", align: 'left', width: 180 },
        { display:"状态", name:"status", align: 'left', width: 100, type: 'int', render: function(row){
				return "<span class='status" + row.status+"'>"+statusmap[row.status]+"</span>";
            }
         }
      ],
      parms: [ {name:'_ajax', value:1}
          <c:if test="${not empty eqId}">, { name:'eqId',value:'${eqId}'}</c:if>
          <c:if test="${not empty likeName}">, { name:'likeName',value:'${likeName}'}</c:if>
          <c:if test="${not empty eqCode}">, { name:'eqCode',value:'${eqCode}'}</c:if>
          <c:if test="${not empty eqUrl}">, { name:'eqUrl',value:'${eqUrl}'}</c:if>
          <c:if test="${not empty eqModifyUserId}">, { name:'eqModifyUserId',value:'${eqModifyUserId}'}</c:if>
          <c:if test="${not empty eqModifyTime}">, { name:'eqModifyTime',value:'${eqModifyTime}'}</c:if>
          <c:if test="${not empty eqCreateTime}">, { name:'eqCreateTime',value:'${eqCreateTime}'}</c:if>
          <c:if test="${not empty eqCreateUserId}">, { name:'eqCreateUserId',value:'${eqCreateUserId}'}</c:if>
         ] ,
	    pageSize: 10, pageSizeOptions:[5,10,20,40,60,80,100],
	    pageParmName:'pageNo', pagesizeParmName:'pageSize', sortnameParmName:'sortName',sortorderParmName:'sortOrder',
	    dataAction:'server', 
	    url: '${rootpath}/select.do?eqIsShow=1&eqStatus=1',
		<c:choose><c:when test="${param.gridMultiple=='1'}">checkbox: true,</c:when>
		<c:otherwise>checkbox: false,onSelectRow: function (data, rowindex, rowobj){parent.window.f_selectDO(f_selected())},</c:otherwise></c:choose>
		frozen: false , dateFormat:'yyyy-MM-dd hh:mm', 
		width: '100%', height: '85%', rowHeight:25, fixedCellHeight: true, usePager: true
	});
    function f_selected(){
        return grid.getSelectedRows();
    }
	jQuery("#searchbutton").click(function(){
	    var params = '';
        var group = {};
		var form=$("#searchForm");
        $(":input", form).not(":submit, :reset, :image,:button, [disabled]").each(function (){
            if (!this.name) return;
            if ($(this).val() == null || $(this).val() == "") return;
            var ltype = $(this).attr("ltype");
            var optionsJSON = $(this).attr("ligerui"), options;
            if (optionsJSON)
            {
                options = JSON2.parse(optionsJSON);
            }
            //get the value type(number or date)
            var value = $(this).val();
            var name = this.name;
            //如果是下拉框，那么读取下拉框关联的隐藏控件的值(ID值,常用与外表关联)
            if (ltype == "select" && options && options.valueFieldID)
            {
                value = $("#" + options.valueFieldID).val();
                name = options.valueFieldID;
            }
            group[name]=value;
			params += ("&"+name+"="+encodeURIComponent(value));
        });
	    grid.set('parms', group);
        grid.loadData();
        $("#queryParam").val( params.substring(1) );
	});
	$("#searchForm").ligerForm();
</script>
</body>
</html>